#all:
#	gcc -Wall -O0 -mcpu=arm7tdmi-s -mapcs -mthumb-interwork -o flash.o flash.c -nostartfiles -nodefaultlibs -nostdlib -Wl,-e,main
#	objcopy -Obinary -j.text flash.o flash.bin
#	objdump --disassemble-all -bbinary -marm7tdmi flash.bin > flash.asm
#

CC=`which arm-elf-gcc`
AS=`which arm-elf-as`
LD=`which arm-elf-ld`
OBJCOPY=`which arm-elf-objcopy`

all:
	$(CC) -W -Wall -O3 -msoft-float -mcpu=arm7tdmi -mapcs -c -o flash.o flash.c
	$(AS) --warn -mfpu=softfpa -mcpu=arm7tdmi -mapcs-32 -o crt0.o crt0.s
	$(LD) -O3 --gc-sections crt0.o flash.o -o flash.elf
	$(OBJCOPY) -O binary flash.elf flash.bin

clean:
	rm -f flash.o crt0.o flash.elf flash.bin
